﻿using System.ComponentModel.DataAnnotations;

namespace Robotec.NET.Application;

    /// <summary>
    /// 数据迁移基础输入参数
    /// </summary>
    public class SysDataTransferBaseInput
    {
        /// <summary>
        /// 源数据链接字符串
        /// </summary>
        public virtual string? SourceConnectionString { get; set; }
        
        /// <summary>
        /// 源数据库配置编号
        /// </summary>
        public virtual string? SourceConfigId { get; set; }
        
        /// <summary>
        /// 源数据库名称
        /// </summary>
        public virtual string? SourceDbName { get; set; }
        
        /// <summary>
        /// 源数据库类型
        /// </summary>
        public virtual MyDbType? SourceDbType { get; set; }
        
    [SugarColumn(IsJson =true)]
    public List<object> SourceTableAttribute { get; set; }  = new List<object>();
    [SugarColumn(IsJson =true)]
    public List<object> SourceOnlyTransferTables { get; set; }  = new List<object>();
    [SugarColumn(IsJson =true)]
    public List<object> SourceExcludeTables { get; set; }  = new List<object>();
        /// <summary>
        /// 是否清空目标表
        /// </summary>
        public virtual bool? ClearTargetTableFlag { get; set; }
        
        /// <summary>
        /// 目标数据库配置编码
        /// </summary>
        public virtual string? TargetConfigId { get; set; }
        
        /// <summary>
        /// 目标数据库名称
        /// </summary>
        public virtual string? TargetDbName { get; set; }
        
        /// <summary>
        /// 目标数据库类型
        /// </summary>
        public virtual MyDbType? TargetDbType { get; set; }
        
        /// <summary>
        /// 目标数据链接字符串
        /// </summary>
        public virtual string? TargetConnectionString { get; set; }
        
        /// <summary>
        /// 迁移日志内容
        /// </summary>
        public virtual string? Description { get; set; }
        
        /// <summary>
        /// 更新时间
        /// </summary>
        public virtual DateTime? UpdateTime { get; set; }
        
    }

    /// <summary>
    /// 数据迁移分页查询输入参数
    /// </summary>
    public class SysDataTransferInput : BasePageInput
    {
        /// <summary>
        /// 关键字查询
        /// </summary>
        public string SearchKey { get; set; }

            /// <summary>
            /// 源数据链接字符串
            /// </summary>
            public string? SourceConnectionString { get; set; }
            
            /// <summary>
            /// 源数据库配置编号
            /// </summary>
            public string? SourceConfigId { get; set; }
            
            /// <summary>
            /// 源数据库名称
            /// </summary>
            public string? SourceDbName { get; set; }
            
              /// <summary>
             /// 源数据库类型
             /// </summary>
             public MyDbType? SourceDbType { get; set; }
             
            /// <summary>
            /// 是否清空目标表
            /// </summary>
            public bool? ClearTargetTableFlag { get; set; }
            
            /// <summary>
            /// 目标数据库配置编码
            /// </summary>
            public string? TargetConfigId { get; set; }
            
            /// <summary>
            /// 目标数据库名称
            /// </summary>
            public string? TargetDbName { get; set; }
            
              /// <summary>
             /// 目标数据库类型
             /// </summary>
             public MyDbType? TargetDbType { get; set; }
             
            /// <summary>
            /// 目标数据链接字符串
            /// </summary>
            public string? TargetConnectionString { get; set; }
            
    }

    /// <summary>
    /// 数据迁移增加输入参数
    /// </summary>
    public class AddSysDataTransferInput : SysDataTransferBaseInput
    {
    }

    /// <summary>
    /// 数据迁移删除输入参数
    /// </summary>
    public class DeleteSysDataTransferInput : BaseIdInput
    {
    }

    /// <summary>
    /// 数据迁移更新输入参数
    /// </summary>
    public class UpdateSysDataTransferInput : SysDataTransferBaseInput
    {
        /// <summary>
        /// Id
        /// </summary>
        [Required(ErrorMessage = "Id不能为空")]
        public long? Id { get; set; }
        
    }

    /// <summary>
    /// 数据迁移主键查询输入参数
    /// </summary>
    public class QueryByIdSysDataTransferInput : DeleteSysDataTransferInput
    {

    }
